<template>
	<view>
		<text class="iconfont icon-done"></text>
		<text class="uniui-icon-symbol-tool-03"></text>
		<button @tap="loginFunc">测试登录接口</button>
		<button @tap="loginFunc2">测试登录接口-报错</button>
		<button @tap="getCode">验证码接口</button>
	</view>
</template>

<script setup>
	// @ 指代项目更目录
	import { getCodeApi } from '../../apis/user'
	import { request } from '@/utils/request.ts'
	const loginFunc = async () => {
		try {
			const res = await request.post('/login/password', {
				password: 'abc12345',
				mobile: '13230000067',
			})
			console.log(res)
		} catch (e) {
			//TODO handle the exception
			console.log('error:', e)
		}
	}
	const loginFunc2 = async () => {
		try {
			const res = await request.post(
				'/login/password',
				{
					password: 'abc123456',
					mobile: '13230000067',
				},
				{ custom: { showLoading: false } }
			)
			console.log(res)
		} catch (e) {
			//TODO handle the exception
			console.log('error:', e)
		}
	}

	const getCode = async () => {
		const res = await getCodeApi({ mobile: '13230000068', type: 'login' })
		console.log(res.code)
	}
</script>

<style></style>
